<#assign imports = []>
<#list columns?filter(c -> c.list) as column>
    <#if !(imports?seq_contains(column.javaType.fullyQualifiedName))>
        <#assign imports += [column.javaType.fullyQualifiedName]>
    </#if>
</#list>
<#-- 计算出需要导入的import -->
<#assign primaryKeyType = columns?filter(column -> column.primary)?first.javaType>
<#--  拿到主键类型 -->
package ${packageName}.domain;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import vip.liux.domain.entities.auditing.AuditedEntity;
<#list imports as import>
    import ${import};<#--  导入 -->
</#list>

/**
 * ${tableComment}
* 继承自AuditedEntity的实体类，包含审计信息和主键
* @see ${packageName}.domain.${className}
 */
@Getter
@Setter
@Entity
@Table(name = "${tableName}")
public class ${className} extends AuditedEntity<${primaryKeyType}> {
<#list columns?filter(c -> c.primary == false)?filter(c -> c.list) as column>
    /**
     * ${column.columnComment}
     */
    @Column(name = "${column.columnName}"<#if column.required == true>, nullable = false</#if><#if column.length??>, length = ${column.length}</#if>)
    private ${column.javaType} ${column.javaField};
</#list>

    /**
     * 默认构造函数
     */
    public ${className}() {
        super();
    }

public ${className}(<#list columns?filter(c -> c.primary == false)?filter(c -> c.list) as column>${column.javaType} ${column.javaField}<#if column_has_next>, </#if></#list>) {
<#list columns?filter(c -> c.primary == false)?filter(c -> c.list) as column>
        this.${column.javaField} = ${column.javaField};
</#list>
}
}